#ifndef FILE_DataFile_HPP
#define FILE_DataFile_HPP

#include <fstream>

#include "../System.hpp"

namespace se{

///////////////////////////////////////////////////////////////////////////////
///	\brief Allow to access a file.
///
/// This object is an accessor to a file contained in a .scf file.
/// It's read-only.
///////////////////////////////////////////////////////////////////////////////
class DataFile{
	// TODO : Don't want to think about it now, if someone wants to do it...
	DISALLOW_COPY_AND_ASSIGN(DataFile);
	public :
		
		//constructeur-destructeur
		DataFile();
		void Unload();
		
		~DataFile();
		
		//lecture
		void Read(void* dest, uint32_t sizeToRead);
		std::string GetString();//return a string containing the caracters until the first NULL character
		void Seek(uint32_t pos);//from begining
		FileSize_t GetSize() const;
		const char* GetContentPtr() const;
		char operator[](const unsigned int i) const;
		
	private :
		DataFile(char * fileContent, FileSize_t fileSize, bool ownsContent);
		
		void Load(char * fileContent, FileSize_t fileSize, bool ownsContent);
		friend class ContentFile;
		
		char* m_content;
		FileSize_t m_size;
		uint32_t m_iterator;
		bool m_ownsContent;
};

}//namespace se

#endif // FILE_DataFile_HPP
